{* Smarty *}
<div id="main_header">{t}{$command}{/t} > {t}{$options}{/t}</div>
{if !empty($msg)}
	<div id="error"><tt>{$msg}</tt></div>
{/if}

{if isset($result)}
<div class="box">
	<form action="/admin/accesscontrol/perms/save_perms"  method="post">
	<table cellspacing="0">
		<caption>{t}perms by role{/t}</caption>
		<tr>
			<th>{t}perms{/t}</th>
		</tr>
		<tr>
			<td class="success"><a class="success" href="/admin/accesscontrol/perms">{t}perms saved{/t}</a></td>
		</tr>
	</table>
</div>
{else}
<div class="box">
	<form action="/admin/accesscontrol/perms/save_perms"  method="post">
	<table cellspacing="0">
		<caption>{t}perms by role{/t}</caption>
		{if $num_of_roles > 3}
		<tr>
			<td colspan="{$colspan+1}" class="pager_top">
					{if $pageno == 1}
{html_image file="/themes/$template/images/go-next.gif" border="0" href="/admin/accesscontrol/perms/`$pageno+1`"}
					{else}
{html_image file="/themes/$template/images/go-previous.gif" border="0" href="/admin/accesscontrol/perms/`$pageno-1`"}&nbsp;&nbsp;&nbsp;
{html_image file="/themes/$template/images/go-next.gif" border="0" href="/admin/accesscontrol/perms/`$pageno+1`"}
					{/if}
			</td>
		</tr>
		{/if}
		<tr>
			<th class="perms">{t}perms{/t}</th>
			{foreach from=$roles item=role}
			<input type="hidden" name="rid[{$role.rid}]" value="">
			{if $role.rid == 1 || $role.rid == 2 || $role.rid == 3}
			{assign var=role value="$role[1]"}
			<th class="top">{t}{$role}{/t}</th>
			{else}
			<th class="top">{$role.name}</th>
			{/if}
			{/foreach}
		</tr>
		{foreach item=module from=$modules_perms}
		<tr>
			<th class="modules" colspan="{$colspan+1}">{$module.name}: <small>{$module.description}</small></th>
		</tr>
			{foreach item=perm from=$module.perms}
			<tr>
				<td class="perms">{$perm}</td>
				{foreach from=$roles item=role}
				{if isset($cperms[$role.rid][$module.name][$perm])}
				<td><input type="checkbox" name="perms[{$role.rid}][{$module.name}][]" value="{$perm}" checked="checked"></td>
				{else}
				<td><input type="checkbox" name="perms[{$role.rid}][{$module.name}][]" value="{$perm}"></td>
				{/if}
				{/foreach}
			</tr>
			{/foreach}
		{/foreach}
		{if $num_of_roles > 3}
		<tr>
			<td colspan="{$colspan+1}" class="pager_bottom">
				{if $pageno == 1}
{html_image file="/themes/$template/images/go-next.gif" border="0" href="/admin/accesscontrol/perms/`$pageno+1`"}
				{else}
{html_image file="/themes/$template/images/go-previous.gif" border="0" href="/admin/accesscontrol/perms/`$pageno-1`"}&nbsp;&nbsp;&nbsp;
{html_image file="/themes/$template/images/go-next.gif" border="0" href="/admin/accesscontrol/perms/`$pageno+1`"}
				{/if}
			</td>
		</tr>
		{/if}
	</table>
	<input type="submit" value="{t}submit{/t}" />
	</form>
</div>
<div class="spacer"></div>
{/if}